package cn.gemiman.daoyi.server.config;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import feign.Target;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

@Component
public class BootFeignReqInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        Target<?> target = template.feignTarget();
        Target.HardCodedTarget hardCodedTarget = new Target.HardCodedTarget<>(target.type(), target.name(), "http://localhost:48080");
        template.feignTarget(hardCodedTarget);
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
    }
}

